﻿<%@ Page Language="C#" %>
<%@ Register Src="~/modules/AccountWindow.ascx" TagName="AccountWindow" TagPrefix="mod" %>
<script runat="server">
    [DirectMethod(ShowMask = true)]
    public void CreateWindow()
    {
        Desktop.GetInstance().CreateWindow(new Window
        {
            Title = "New window",
            Width = 300,
            Height = 300,
            CloseAction = CloseAction.Destroy,
            Html = "The window is created"
        });
    }

    public void Logout_Click(object sender, DirectEventArgs e)
    {

    }
</script>
<!DOCTYPE html>
<html>
<head runat="server">
    <title></title>
    <link href="resources/css/main.css" rel="stylesheet" type="text/css" />
    <link href="resources/desktop/desktop.css" rel="stylesheet" type="text/css" />
    <script src="resources/js/main.js" type="text/javascript"></script>
    <script type="text/javascript">
        var tile = function () {
            Ext.net.Desktop.desktop.tileWindows();
        };

        var cascade = function () {
            Ext.net.Desktop.desktop.cascadeWindows();
        };

        var initSlidePanel = function () {
            this.setHeight(Ext.net.Desktop.desktop.body.getHeight());

            if (!this.windowListen) {
                this.windowListen = true;

                this.el.alignTo(Ext.net.Desktop.desktop.body, 'tl-tr', [0, 0]);
                Ext.EventManager.onWindowResize(initSlidePanel, this);
            }
        };
    </script>
</head>
<body>
    <ext:ResourceManager runat="server">
        <Listeners>
            <WindowResize Handler="Ext.net.Bus.publish('App.Desktop.ready');" Buffer="500" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Desktop ID="Desktop1" runat="server">
        <Modules>
            <ext:DesktopModule ModuleID="notepad">
                <Shortcut Name="记事本" IconCls="x-notepad-shortcut" SortIndex="2" />
                <Launcher Text="记事本" Icon="ApplicationForm" />
                <Window>
                    <ext:Window ID="Window2" runat="server" Title="记事本" Width="600" Height="400"
                        Icon="ApplicationForm" AnimCollapse="false" Border="false" HideMode="Offsets"
                        Layout="FitLayout" CloseAction="Destroy">
                        <Items>
                            <ext:HtmlEditor ID="HtmlEditor1" runat="server" Text="">
                            </ext:HtmlEditor>
                        </Items>
                    </ext:Window>
                </Window>
            </ext:DesktopModule>            
        </Modules>
        <DesktopConfig Wallpaper="resources/wallpapers/desk.jpg" ShortcutDragSelector="true">
            <ShortcutDefaults IconCls="x-default-shortcut" />
            <ContextMenu>
                <ext:Menu ID="Menu1" runat="server">
                    <Items>
                        <ext:MenuItem ID="MenuItem1" runat="server" Text="Change Settings" />
                        <ext:MenuSeparator ID="MenuSeparator1" runat="server" />
                        <ext:MenuItem ID="MenuItem2" runat="server" Text="Tile" Handler="tile" Icon="ApplicationTileVertical" />
                        <ext:MenuItem ID="MenuItem3" runat="server" Text="Cascade" Handler="cascade" Icon="ApplicationCascade" />
                    </Items>
                </ext:Menu>
            </ContextMenu>
        </DesktopConfig>
        <StartMenu Title="DevDL权限管理系统" Icon="Application" Height="300">
            <ToolConfig>
                <ext:Toolbar ID="Toolbar2" runat="server" Width="100">
                    <Items>
                        <ext:Button ID="Button6" runat="server" Text="Settings" Icon="Cog" />
                        <ext:Button ID="Button7" runat="server" Text="Logout" Icon="Key">
                            <DirectEvents>
                                <Click OnEvent="Logout_Click">
                                    <EventMask ShowMask="true" Msg="Good Bye..." MinDelay="1000" />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </ToolConfig>
        </StartMenu>
        <TaskBar TrayWidth="100">
            <QuickStart>
                <ext:Toolbar ID="Toolbar3" runat="server">
                    <Items>
                        <ext:Button ID="Button8" runat="server" Handler="tile" Icon="ApplicationTileVertical">
                            <QTipCfg Text="Tile windows" />
                        </ext:Button>
                        <ext:Button ID="Button9" runat="server" Handler="cascade" Icon="ApplicationCascade">
                            <QTipCfg Text="Cascade windows" />
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </QuickStart>
            <Tray>
                <ext:Toolbar ID="Toolbar4" runat="server">
                    <Items>
                        <ext:Button ID="LangButton" runat="server" Text="EN" MenuArrow="false" Cls="x-bold-text"
                            MenuAlign="br-tr">
                            <Menu>
                                <ext:Menu ID="Menu2" runat="server">
                                    <Items>
                                        <ext:CheckMenuItem ID="CheckMenuItem1" runat="server" Group="lang" Text="English"
                                            Checked="true" CheckHandler="function(item, checked) {checked && #{LangButton}.setText('EN');}" />
                                        <ext:CheckMenuItem ID="CheckMenuItem2" runat="server" Group="lang" Text="French"
                                            CheckHandler="function(item, checked) {checked && #{LangButton}.setText('FR');}" />
                                        <ext:MenuSeparator ID="MenuSeparator2" runat="server" />
                                        <ext:MenuItem ID="MenuItem4" runat="server" Text="Show the Language Bar" />
                                    </Items>
                                </ext:Menu>
                            </Menu>
                        </ext:Button>
                        <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                    </Items>
                </ext:Toolbar>
            </Tray>
        </TaskBar>
        <Listeners>
            <Ready BroadcastOnBus="App.Desktop.ready" />
        </Listeners>
    </ext:Desktop>
    <ext:Panel ID="Panel1" runat="server" Title="Slide panel" Frame="true" Width="250"
        Layout="AccordionLayout" Floating="true" Shadow="false">
        <Items>
            <ext:Panel ID="Panel2" runat="server" Title="Section 1" Icon="User" />
            <ext:Panel ID="Panel3" runat="server" Title="Section 2" Icon="UserB" />
            <ext:Panel ID="Panel4" runat="server" Title="Section 3" Icon="UserB" />
            <ext:Panel ID="Panel5" runat="server" Title="Section 4" Icon="UserB" />
            <ext:Panel ID="Panel6" runat="server" Title="Section 5" Icon="UserB" />
        </Items>
        <MessageBusListeners>
            <ext:MessageBusListener Name="App.Desktop.ready" Fn="initSlidePanel" />
        </MessageBusListeners>
        <Plugins>
            <ext:MouseDistanceSensor ID="MouseDistanceSensor1" runat="server" Opacity="false"
                Threshold="25">
                <Listeners>
                    <Near Handler="this.component.el.alignTo(Ext.net.Desktop.desktop.body, 'tr-tr', [0, 0], true);" />
                    <Far Handler="this.component.el.alignTo(Ext.net.Desktop.desktop.body, 'tl-tr', [0, 0], true);" />
                </Listeners>
            </ext:MouseDistanceSensor>
        </Plugins>
    </ext:Panel>
    <mod:AccountWindow ID="acc_win"  runat="server" />
</body>
</html>
